package homework03;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

public class Test {

    public void setProperty(Object obj, String propertyName, Object value) throws Exception {
        Class clz = obj.getClass();
        Field name = clz.getDeclaredField("propertyName");
        name.setAccessible(true);
        name.set(obj, value);
    }

    public Object getProperty(Object obj, String propertyName) throws Exception {
        Class clz = obj.getClass();
        Field field = clz.getDeclaredField("propertyName");
        field.setAccessible(true);
        return field.get(obj);
    }
}
